/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 * 
 * Copyright 2012 Medavie BlueCross. All rights reserved.
 * 
 * The contents of this file are subject to the Medavie Blue Cross
 * Application Code terms of use policy, for more information contact
 * Medavie Blue Cross.
 */
package com.binkam.merashehar.common.database;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 *
 * @author sunchak
 */
public class ConnectionManager {

    
    private String host = "localhost";
    private String port = "3306";
    private String schemaName = "msdb";
    private String username = "root";
    private String password = "mysql";

    public Connection getMySqlConnection() throws Exception {
        String driver = "com.mysql.jdbc.Driver";
        String url = "jdbc:mysql://"+host+":"+port+"/"+schemaName;
        Class.forName(driver); // load MySQL driver
        Connection conn = DriverManager.getConnection(url, username, password);
        return conn;
    }

    public Connection getMySqlConnection(String host, String port, String username, String password, String schemaName) throws Exception {
        String driver = "com.mysql.jdbc.Driver";
        String url = "jdbc:mysql://"+host+":"+port+"/"+schemaName;
        Class.forName(driver); // load MySQL driver
        Connection conn = DriverManager.getConnection(url, username, password);
        return conn;
    }
}
